#define _CRT_SECURE_NO_WARNINGS 1
#include <stdio.h>
#include <string.h>

reverse_string(char* left, char* right)
{
	while (left < right)
	{
		char tmp = *left;
		*left = *right;
		*right = tmp;
		left++;
		right--;
	}
}

int main()
{
	char arr[100] = { 0 };
	scanf("%[^\n]", arr);
	reverse_string(arr, arr + strlen(arr) - 1);
	char* start = arr;
	char* ter = arr;
	while (*ter)
	{
		while (*ter != ' ' && *ter != '\0')
		{
			ter++;
		}
		reverse_string(start, ter - 1);
		start = ter + 1;
		if (*ter != '\0')
			ter++;
	}

	printf("%s", arr);
	return 0;
}